<%-- 
    Document   : chinhsualichsu
    Created on : Dec 9, 2011, 10:45:48 PM
    Author     : BlueZky
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<link rel="stylesheet" type="text/css" href="styles/userstyles.css" />
<link rel="stylesheet" type="text/css" href="styles/simple.css" />

<c:if test="${hoaDon eq null}">
    <div class ="title">Không tim thấy đơn đặt hàng yêu cầu</div>
</c:if>
<c:if test="${message ne null}">
    <c:if test="${success eq 'true'}">
    <div class="success">${message}</div>
    </c:if>
    <c:if test="${success eq 'false'}">
    <div class="error">${message}</div>
    </c:if>
</c:if>
<c:if test="${hoaDon ne null}">
    <div class ="title">Cập nhật đơn đặt hàng ${hoaDon.mahd}</div>

    <form method="post" action="lichsumuahang.htm">
        <div class="utitle">Thông tin người nhận</div>

        <input type="hidden" name="a" value="uu"/>
        <input type="hidden" name="pid" value="0"/>
        <table>
            <tr>
                <td class="cell-left"><b>Tên người nhận</b></td>
                <td class="cell-right input"><input  type="text" name="receivedName" value="${hoaDon.nguoinhan}" /></td>
            </tr>
            <tr>
                <td class="cell-left"><b>Địa chỉ </b></td>
                <td class="cell-right input"><input type="text" name="receivedAddress" value="${hoaDon.diachinhan}" /></td>
            </tr>
            <tr>
                <td class="cell-left"><b>Số điện thoại</b></td>
                <td class="cell-right input"><input  type="text" name="receivedPhone" value="${hoaDon.sodtnhan}" /></td>
            </tr>
            <tr>
                <td class="cell-left"><b>CMND</b></td>
                <td class="cell-right input"><input type="text" name="receivedID" value="${hoaDon.cmndnhan}" /></td>
            </tr>         
            <tr>
                <td ></td>
                <td class="cell-right button" > 
                    <span class="button"><input type="submit" value="Cập nhật"></span></a>
                </td>
            </tr>
        </table>

        <div class="utitle" style="margin-top: 20px;">Danh sách sản phẩm đặt mua</div>
        <div class="box">
            <c:if test="${chiTiet.size() gt 0}">
                <c:set var="sum" value="0"></c:set>

                <table class="utable" cellspacing="0px" cellpadding="10px" >
                    <tr>
                        <th style="width:20px;">STT</th>
                        <th>Sản phẩm</td>
                        <th style="width:50px;">Số lượng</th>
                        <th style="width:70px;">Đơn giá</th>
                        <th style="width:70px;">Khuyến mãi</th>
                        <th style="width:100px;" colspan="2">Thành tiền</th>
                    </tr>
                    <c:forEach items="${chiTiet}" var="item" varStatus="status">
                        <tr >
                            <td style="border-left: 1px #ddd solid;">${status.index + 1}</td>
                            <td><a href="chitiet.htm?PID=${item.sanpham.masp}" style="color: #00CED1;">${item.sanpham.tensp}</a></td>
                            <td><input type="text" name="soLuong" value="${item.soluong}"/></td>
                            <td style="text-align: right">${item.dongia} $</td>
                            <td style="text-align: right">0</td>
                            <td colspan="2"><b><fmt:formatNumber value="${item.soluong*item.dongia}"/> $</b></td>
                        </tr>
                    </c:forEach>
                    <tr>
                        <td colspan="5"  style="border-left: 1px #ddd solid;text-align: center">Thành tiền</td>
                        <td colspan="2" class="ucart" style=" color: orange;"><fmt:formatNumber value="${hoaDon.tongtien}"/> $</td>
                    </tr>
                    <tr>
                        <td colspan="5"  style="border-left: 1px #ddd solid;text-align: center">Khuyến mãi</td>
                        <td colspan="2" class="ucart" style=" color: orange;"><fmt:formatNumber value="${khuyenmai}"/> $</td>
                    </tr>
                    <tr>
                        <td colspan="5"  style="border-left: 1px #ddd solid;text-align: center">Thanh toán</td>
                        <td colspan="2" class="ucart" style=" color: orange;"><fmt:formatNumber value="${hoaDon.tongtien - khuyenmai}"/>  $</td>
                    </tr>
                    <tr>
                        <td style="border: none;"></td>
                        <td  style="border: none;"></td>
                        <td style="border: none;" class="cell-right button" colspan="2" > 
                            <span class="button"><input type="submit" value="Cập nhật"></span></a>
                        </td>
                        <td style="border: none;"></td>
                        <td style="border: none;" ></td>
                        <td  style="border: none;"></td>
                    </tr>
                </table>
            </c:if>
        </div>
    </form>
</c:if>